//canvas画笔

//绘制圆形
export function drawCicle(ctx, width, left, top){
	/* ctx.moveTo(left+width/2, top+width/2);
	ctx.arc(left+width/2, top+width/2, width/2, 0, Math.PI*2, true);
	ctx.strokeStyle = 'red';
	//ctx.closePath();
	ctx.stroke();
	ctx.clip(); */
	ctx.save();
	ctx.beginPath();
	ctx.strokeStyle = 'transparent';
	let r = width/2;  //半径
	ctx.moveTo(left+r, top+r);
	ctx.arc(left+r, top+r, r, 0, Math.PI*2);
	
	ctx.stroke();
	ctx.restore();
	ctx.clip();
}


//绘制圆角矩形
export function drawRoundRect(ctx, width, height, left, top, borderRadius){
	ctx.moveTo(left, top+borderRadius);
	ctx.arcTo(left, top,  left+borderRadius, top, borderRadius); //创建第一个弧
	ctx.lineTo(left+width - borderRadius, top);
	ctx.arcTo(left+width, top, left+width, top+borderRadius, borderRadius);
	ctx.lineTo(left+width, top+height - borderRadius);
	ctx.arcTo(left+width, top+height, left+width-borderRadius, top+height, borderRadius);
	ctx.lineTo(borderRadius, top+height);
	ctx.arcTo(left, top+height, left, top+height - borderRadius, borderRadius);
	ctx.lineTo(left, top+borderRadius);
	ctx.clip();
}